package kk.dao;

import kk.domain.Orders;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 订单类接口
 */
public interface OrdersDao {
    /**
     * 查询所有订单
     * @return
     */
    public List<Orders> findAll() throws Exception;

    /**
     * 根据id查询订单及其详情
     * @param id
     * @return
     * @throws Exception
     */
    public Orders findById(Integer id)throws Exception;

    /**
     * 查询一个订单的信息
     * @param id
     * @return
     * @throws Exception
     */
    public Orders findOneOrder(Integer id) throws Exception;

    /**
     * 根据产品id删除订单
     * @param pid
     * @throws Exception
     */
    public void deleteByProductId(Integer pid) throws Exception;

    /**
     * 根据会员Id删除订单
     * @param mid
     * @throws Exception
     */
    public void deleteByMemberId(Integer mid) throws Exception;

    /**
     * 根据订单id删除订单
     * @param oid
     * @throws Exception
     */
    public void deleteByOrdersId(Integer oid) throws Exception;

    /**
     * 根据订单的id删除order_traveller表中的相关数据
     * @param oid
     * @throws Exception
     */
    public void deleteFromOrder_TravellerByOrdersId(Integer oid) throws Exception;

    /**
     * 修改订单信息
     * @param orders
     * @throws Exception
     */
    public void update(Orders orders) throws Exception;

    /**
     * 添加订单
     * @param orders
     * @throws Exception
     */
    public void add(Orders orders) throws Exception;

    /**
     * 向order_traveller表中添加数据
     * @param orderId
     * @param travellerId
     * @throws Exception
     */
    public void insertIntoOrder_Traveller(@Param("orderId") Integer orderId,@Param("travellerId") Integer travellerId) throws Exception;

    /**
     * 根据订单编号模糊查询订单
     * @param orderNum
     * @return
     */
    public List<Orders> findByOrderNum(String orderNum);


}
